package com.panfeng.xcloud.boss.provider.assets.config;

import com.panfeng.xcloud.common.core.constants.RabbitMQConstant;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitMQConfig {

    /**
     * @return
     */
    @Bean
    DirectExchange huoBiSendTradeDirectExchange() {
        return new DirectExchange("huoBiSendTrade");
    }

    /**
     * 火币下单
     *
     * @return
     */
    @Bean
    public Queue huoBiSendTradeQueue() {
        return new Queue(RabbitMQConstant.HUO_BI_SEND_TRADE_QUEUE, true);
    }

    @Bean
    Binding bindingHuoBiSendTradeQueueToDirectExchange(Queue huoBiSendTradeQueue, DirectExchange huoBiSendTradeDirectExchange) {
        return BindingBuilder.bind(huoBiSendTradeQueue).to(huoBiSendTradeDirectExchange).with("huoBiSendTrade");
    }

    /**
     * @return
     */
    @Bean
    DirectExchange huoBiDoSendTradeDirectExchange() {
        return new DirectExchange("huoBiDoSendTrade");
    }

    /**
     * 火币实际下单
     *
     * @return
     */
    @Bean
    public Queue huoBiDoSendTradeQueue() {
        return new Queue(RabbitMQConstant.HUO_BI_DO_SEND_TRADE_QUEUE, true);
    }

    @Bean
    Binding bindingHuoBiDoSendTradeQueueToDirectExchange(Queue huoBiDoSendTradeQueue, DirectExchange huoBiDoSendTradeDirectExchange) {
        return BindingBuilder.bind(huoBiDoSendTradeQueue).to(huoBiDoSendTradeDirectExchange).with("huoBiDoSendTrade");
    }




    @Bean
    DirectExchange quantBotDirectExchange() {
        return new DirectExchange("quantBot");
    }

    @Bean
    public Queue quantBotQueue() {
        return new Queue(RabbitMQConstant.QUANT_BOT_QUEUE, true);
    }

    @Bean
    Binding bindingQuantBotQueueToDirectExchange(Queue quantBotQueue, DirectExchange quantBotDirectExchange) {
        return BindingBuilder.bind(quantBotQueue).to(quantBotDirectExchange).with("quantBot");
    }

}
